home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
404 Jogos
/
CLJG.iso
/
Aventura
/
FireMan.swf
/
scripts
/
frame_1055
/
PlaceObject2_436_125
/
CLIPACTIONRECORD onClipEvent(enterFrame).as
next >
Wrap
Text File
|
2008-09-12
|
3KB
|
146 lines
onClipEvent(enterFrame){
function doexplode()
{
myColor.setTransform(myColorNormal);
this.gotoAndStop("death");
}
function dorespawn()
{
currentdamage = 0;
hitted = false;
flashing = false;
timerdamage = 0;
death = false;
dx = 0;
this.gotoAndStop("standing");
idle = true;
descending = false;
attack = false;
_X = xi;
_Y = yi;
}
function drawframe()
{
!forward ? (_xscale = Math.abs(_xscale)) : (_xscale = Math.abs(_xscale) * -1);
if(attack)
{
this.gotoAndStop("attack");
}
else
{
this.gotoAndStop("standing");
}
}
xi -= heroe.scrollspeed;
_X = _X - heroe.scrollspeed;
_Y = _Y - heroe.vscrollspeed;
yi -= heroe.vscrollspeed;
_visible = false;
hitable = this.hitTest(_parent.mascara);
if(hitable)
{
_visible = true;
if(this.sprite.hotzone.hitTest(heroe.sprite.hotzone))
{
heroe.damage = 2;
heroe.hitted = true;
}
if(this.sprite.hotzone.hitTest(_parent.shoot1) && hitable)
{
hitted = true;
_root.shoot1.impact = true;
_root.hitted.start();
}
if(timerdamage == 0 && hitted)
{
timerdamage = FLASHTIME;
currentdamage += DAMAGE;
}
if(timerdamage > 0)
{
flashing = true;
timerdamage % 3 != 0 ? myColor.setTransform(myColorNormal) : myColor.setTransform(myColorTransform);
timerdamage--;
}
if(flashing && timerdamage == 0)
{
flashing = false;
myColor.setTransform(myColorNormal);
hitted = false;
}
if(currentdamage >= MAXDAMAGE)
{
myColor.setTransform(myColorTransform);
death = true;
}
if(death)
{
_root.shoot1.impact = false;
doexplode();
dx = 0;
}
}
if(!death)
{
if(idle)
{
if(Math.abs(heroe._x - _X) <= 160 && _root.mascara.hitTest(_X,_Y + 20))
{
idle = false;
descending = true;
if(_X > heroe._x)
{
dx = SPEED;
forward = false;
}
else
{
dx = -1 * SPEED;
forward = true;
}
}
}
if(descending)
{
heroe.DAMAGE = 2;
dy = 3;
_Y = _Y + dy;
if(_Y >= heroe._y - heroe._height / 2 && heroe.vertical == 0)
{
dy = 0;
descending = false;
attack = true;
if(_X > heroe._x)
{
dx = SPEED;
forward = false;
}
else
{
dx = -1 * SPEED;
forward = true;
}
}
}
if(attack)
{
heroe.DAMAGE = 3;
dx *= 1.3;
if(Math.abs(dx) >= MAX)
{
dx <= 0 ? (dx = -1 * MAX) : (dx = MAX);
}
_X = _X - dx;
if(Math.abs(_X - 160) >= 260)
{
dorespawn();
}
}
drawframe();
}
else if(!_root.mascara.hitTest(xi,yi + 20))
{
dorespawn();
}
}